package com.android.geotrack;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class LoginActivity extends Activity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);
        
        // Last.fm username view
        final EditText userView = (EditText) findViewById(R.id.userView);
        
        // Login
        final Button loginButton = (Button) findViewById(R.id.loginButton);
        loginButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            	String user = userView.getText().toString();
            	if(! user.equals("")) {
	            	Intent i = new Intent(LoginActivity.this, GeoTrack.class);
	            	i.putExtra("user", user);
	            	LoginActivity.this.startActivity(i);
            	}
            }
        });
        
        // Login
        final Button exitButton = (Button) findViewById(R.id.exitButton);
        exitButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            	finish();
            }
        });
    }

}